package biz.ezcom.design.pattern.factory.simple;

/**
 * 运算操作的简单工厂 
 */
public class Factory {
	public static Operator newInstance(String operator){
		if("+".equals(operator)){
			return new OperatorAdd();
		}else if("-".equals(operator)){
			return new OperatorSub();
		}else if("*".equals(operator)){
			return new OperatorMul();
		}else if("/".equals(operator)){
			return new OperatorDiv();
		}else {
			throw new RuntimeException("不支持些操作符");
		}
	}
}
